package com.flux;

import reactor.core.publisher.Flux;

import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.CountDownLatch;

/**
 * 描述:
 *
 * @author luzhongfu
 * Created by lucky on 2020-08-24 1:07 PM
 */
public class FluxTest {

    public static void main(String[] args) {
        FluxTest test = new FluxTest();
        test.just();
        test.interval();
    }

    public void just(){
        Flux.just("A","1","3").subscribe(System.out::println);
    }

    public void interval(){
        Flux.interval(Duration.of(100, ChronoUnit.MILLIS))
                .subscribe(System.out::println);
        CountDownLatch latch = new CountDownLatch(1);
        try {
            latch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
